Skip to main content
POST
/
v1
/
flux-2-flex
Generate or edit an image with FLUX.2 [FLEX]
curl --request POST \
  --url https://api.bfl.ai/v1/flux-2-flex \
  --header 'Content-Type: application/json' \
  --header 'x-key: <api-key>' \
  --data '{
  "prompt": "ein fantastisches bild",
  "prompt_upsampling": true,
  "input_image": "<string>",
  "input_image_2": "<string>",
  "input_image_3": "<string>",
  "input_image_4": "<string>",
  "input_image_5": "<string>",
  "input_image_6": "<string>",
  "input_image_7": "<string>",
  "input_image_8": "<string>",
  "input_image_blob_path": "<string>",
  "seed": 42,
  "width": 65,
  "height": 65,
  "guidance": 5,
  "steps": 50,
  "safety_tolerance": 2,
  "output_format": "jpeg",
  "webhook_url": "<string>",
  "webhook_secret": "<string>"
}'
{
  "id": "<string>",
  "polling_url": "<string>",
  "cost": 123,
  "input_mp": 123,
  "output_mp": 123
}

Authorizations

x-key
string
header
required

Body

application/json
prompt
string
required

Text prompt for image generation.

Example:

"ein fantastisches bild"

prompt_upsampling
boolean | null
default:true

Whether to use prompt upsampling.

input_image
string | null

Path to the input image.

input_image_2
string | null

Path to the second input image.

input_image_3
string | null

Path to the third input image.

input_image_4
string | null

Path to the fourth input image.

input_image_5
string | null

Base64 encoded image or URL to use with Kontext. Experimental Multiref

input_image_6
string | null

Base64 encoded image or URL to use with Kontext. Experimental Multiref

input_image_7
string | null

Base64 encoded image or URL to use with Kontext. Experimental Multiref

input_image_8
string | null

Base64 encoded image or URL to use with Kontext. Experimental Multiref

input_image_blob_path
string | null

Blob path to the input image.

seed
integer | null

Optional seed for reproducibility.

Example:

42

width
integer | null
default:0

Width of the image

Required range: x >= 64
height
integer | null
default:0

Height of the image

Required range: x >= 64
guidance
number | null
default:5

Guidance scale for image generation. High guidance scales improve prompt adherence at the cost of reduced realism.

Required range: 1.5 <= x <= 10
Example:

5

steps
integer | null
default:50

Number of steps for image generation. Higher steps lead to more detailed and realistic images.

Required range: 1 <= x <= 50
Example:

50

safety_tolerance
integer
default:2

Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict.

Required range: 0 <= x <= 5
Example:

2

output_format
enum<string> | null
default:jpeg
Available options:
jpeg,
png
webhook_url
string<uri> | null

URL to receive webhook notifications

Required string length: 1 - 2083
webhook_secret
string | null

Optional secret for webhook signature verification

Response

Successful Response

  • AsyncResponse
  • AsyncWebhookResponse
id
string
required
polling_url
string
required
cost
number | null

Cost in credits for this request

input_mp
number | null

Input megapixels (2 decimal places)

output_mp
number | null

Output megapixels (2 decimal places)